<?php include './application/views/common/zhs_header.php';?>

<?php include './application/views/common/zhs_usercenter_acnt.php';?>
<div class="inv_box w">
<?php include './application/views/common/zhs_usercenter_left.php';?>
  <div class="membd_right">
     <h3 class="membdrg_tit">我的个人信息</h3>
     <?php
		$sex = array ('0' => '', '1' => '男', '2' => '女' );
		?>
    <div class="mem_perbox">
    <form id="myform">
    <input type="hidden" name="act" value="contact"> 
    <input type="hidden" name="submit" value="1">
      <ul class="perboxul">
      	 
         <li><span>会员昵称:</span><p><input type="text" name="username0" maxlength="15" value="<?php echo $user ['username']; ?>"><em style="color:red;">*会员昵称不允许纯数字或者为空</em></p></li>
         <li><span>真实姓名:</span>
         	<p><?php echo $user ['realname'];?></p>
		</li>
         <li><span>电子邮箱:</span>
         	<p><?php echo $user ['email']; ?></p>
		</li>
         <li><span>手机号码:</span>
         	<p><?php echo $user ['phone']; ?></p>
		</li>
         <li><span>性 别:</span>
         	<p><?php echo $sex [$user ['sex']]; ?></p>
		</li>
         <li><span>籍贯: </span>
        <p> <?php echo isset ( $user ['province'] ) && $user ['province'] > 0 ? $area [$user ['province']] : ''; ?> 
				<?php echo isset ( $user ['city'] ) && $user ['city'] > 0 ? $area [$user ['city']] : ''; ?> 
				<?php echo isset ( $user ['area'] ) && $user ['area'] > 0 ? $area [$user ['area']] : ''; ?> </p>
		</li>
	
	
    <li id = "span_id_msg_user"><span><a href = "javascript:void(0)" onclick = "opr_div(0);">填写更多信息 >></a></span><p></p>   	
		</li>
		
		<div id = "div_id_msg_user" style = "display:none">
		<li><span>现居住地: </span>
        	<p><select name="province" id="province" onchange="getArea(this.value,'','city');"></select> 
			<select name="city" id="city" onchange="getArea(this.value,'','area');">
				<option value="">请选择</option>
			</select> 
			<select name="area" id="area">
				<option value="">请选择</option>
			</select></p>
		</li>
		<li><span>现居住详地: </span>
        	<p><input type="text" name="address" maxlength="30"
			value="<?php echo isset ( $userinfo ['address'] ) ? $userinfo ['address'] : ''; ?>"></p>
		</li>
		 <li><span>QQ: </span><p><input type="text" name="qq" maxlength="11" value="<?php echo isset ( $user ['qq'] ) ? $user ['qq'] : ''; ?>"></p></li>
         
		<li><span>最高学历: </span>
        <p><select name="education_record" id="education_record"></select></p>
		</li>
		<li><span>毕业院校: </span>
       <p> <input type="text" name="education_school" value="<?php echo @$userinfo ['education_school']; ?>"></p>
		</li>
		<li><span>入学年份: </span>
        <p><input type="text" value="<?php if($userinfo ['education_time1'] == 0 || $userinfo ['education_time1']  =='') echo '2014-09-01';else echo isset ( $userinfo ['education_time1'] ) ? date ( 'Y-m-d', $userinfo ['education_time1'] ) : ''; ?>"
			name="education_time1" onfocus="WdatePicker()" readonly="readonly"> 到
		<input type="text" value="<?php if($userinfo ['education_time2'] == 0 || $userinfo ['education_time2']  =='') echo '2014-09-01';else echo isset ( $userinfo ['education_time2'] ) ? date ( 'Y-m-d', $userinfo ['education_time2'] ) : ''; ?>"
			name="education_time2" onfocus="WdatePicker()" readonly="readonly"></p>
		</li>
		<li><span>婚姻状况: </span>
       <p> <select name="marry" id="marry"></select></p>
		</li>
		<li><span>子女状况: </span>
        <p><select name="child" id="child"></select></p>
		</li>
		<li><span>直接亲属联系人1: </span></li>
        <li><span>姓名:</span><p> <input type="text" name="linkman1" maxlength="10" value="<?php echo isset ( $userinfo ['linkman1'] ) ? $userinfo ['linkman1'] : ''; ?>"></p></li>
        <li><span>关系:</span><p> <select name="relation1" id="relation1"></select></li>
        <li><span>手机:</span><p> <input type="text" name="phone1" maxlength="20" value="<?php echo isset ( $userinfo ['phone1'] ) ? $userinfo ['phone1'] : ''; ?>"></p></li>
         
        <li><span>直接亲属联系人2: </span></li>
        <li><span>姓名: </span><p><input type="text" name="linkman2" maxlength="10" value="<?php echo isset ( $userinfo ['linkman2'] ) ? $userinfo ['linkman2'] : ''; ?>"></p></li>
        <li><span>关系:</span><p> <select name="relation2" id="relation2"></select></li>
        <li><span>手机:</span><p> <input type="text" name="phone2" maxlength="20" value="<?php echo isset ( $userinfo ['phone2'] ) ? $userinfo ['phone2'] : ''; ?>"></p></li>
          </div>
          
         <li id = "span_id_msg_user_close" style = "display:none"><span><a href = "javascript:void(0)" onclick = "opr_div(1);">收起更多信息 >></a></span><p></p>   	
				</li>
         <li><a class="mebal" style="margin-left:124px;" href="javascript:;" onclick='toSubmit();'>确认</a><a class="mebar" href="#">取消</a></li>
        
        
      </ul>
      </form>
    </div>
     <script type="text/javascript">
     	
     	function opr_div(data){
     		if(data == 1){
     		  $("#span_id_msg_user").css('display','inline');
     			$("#div_id_msg_user").css('display','none');
     			$("#span_id_msg_user_close").css('display','none');
     		}else{
     			$("#span_id_msg_user").css('display','none');
     			$("#div_id_msg_user").css('display','inline');
     			$("#span_id_msg_user_close").css('display','inline');
     		}
     		
     	}
     	
     	
     $(document).ready(function(){
  		getLinkage('3','<?php
  		echo isset ( $userinfo ['education_record'] ) ? $userinfo ['education_record'] : '';
  		?>','education_record');
  		getLinkage('1','<?php
  		echo isset ( $userinfo ['marry'] ) ? $userinfo ['marry'] : '';
  		?>','marry');
  		getLinkage('2','<?php
  		echo isset ( $userinfo ['child'] ) ? $userinfo ['child'] : '';
  		?>','child');
  		getLinkage('5','<?php
  		echo isset ( $userinfo ['safe'] ) ? $userinfo ['safe'] : '';
  		?>','safe');
  		getLinkage('6','<?php
  		echo isset ( $userinfo ['house'] ) ? $userinfo ['house'] : '';
  		?>','house');
  		getLinkage('7','<?php
  		echo isset ( $userinfo ['car'] ) ? $userinfo ['car'] : '';
  		?>','car');
  		
  		getArea(0,'<?php
  		echo isset ( $userinfo ['province'] ) ? $userinfo ['province'] : '';
  		?>','province');
  		<?php
  		if (isset ( $userinfo ['city'] ) && $userinfo ['city']) {
  			?>
  			getArea('<?php
  			echo $userinfo ['province'];
  			?>','<?php
  			echo $userinfo ['city'];
  			?>','city');
  		<?php
  		}
  		?>
  		
  		<?php
  		if (isset ( $userinfo ['area'] ) && $userinfo ['area']) {
  			?>
  			getArea('<?php
  			echo $userinfo ['city'];
  			?>','<?php
  			echo $userinfo ['area'];
  			?>','area');
  		<?php
  		}
  		?>
  		getLinkage('18','<?php
  		echo isset ( $userinfo ['relation1'] ) ? $userinfo ['relation1'] : '';
  		?>','relation1');
  		getLinkage('18','<?php
  		echo isset ( $userinfo ['relation2'] ) ? $userinfo ['relation2'] : '';
  		?>','relation2');
  	});
  		function getLinkage(type_id, selected, obj){
  			$.ajax({
  				type: "POST",
  				url: "/linkage/get_option",
  				data: "type_id="+type_id+"&selected="+selected,
  				success: function(msg){
  					$("#"+obj).html(msg);
  				},
  				dataType: "text"
  			});
  		}

  		function getArea(pid, selected, obj){
  			$.ajax({
  				type: "POST",
  				url: "/area/get_option",
  				data: "pid="+pid+"&selected="+selected,
  				success: function(msg){
  					$("#"+obj).html(msg);
  				},
  				dataType: "text"
  			});
  		}

  		function toSubmit(){
  			var options = {
  				url : GetUrlRelativePath(),
  				dataType: "json",
  				type:"post",
  				success : function(ret) {
  						$('#dialog').dialog({
  							modal:true,
  							title:'系统提示',
  							buttons:{"确定":function(){$(this).dialog("close");}},
  							close: function() {
  	  							if(ret.url != ''){
  									location=ret.url;
  	  							}
  							}
  						}); 
  						$("#msg").html(ret.msg);
  				}
  			};
  			$("#myform").ajaxSubmit(options);
  			return false;
  		}
     </script>
  </div>
</div> 

<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>

